#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#define MMAX(X,Y)  (X)>(Y) ? (X):(Y)
#define LEN1 20
#define LEN2 30

int dp[LEN1][LEN2];
char* str1= "abcfbc";
char* str2= "abfcab";

int main(){
    int i,j,len1,len2;
    len1 = strlen(str1);
    len2 = strlen(str2);
    for(i=0;i<=len1;i++)
        dp[i][0] = 0;
    for(j=0;i<=len2;j++)
        dp[0][j] = 0;
    for(i=1;i<=len1;i++)
        for(j=1;j<=len2;j++){
            if(str1[i] == str2[j])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = MMAX(dp[i-1][j],dp[i][j-1]);
        }
    printf("%d\n",dp[len1][len2]);
    return 0;
}
